
package gallery.asset
{
	import mx.collections.ICollectionView;
	import mx.collections.ArrayCollection;
	import mx.collections.IViewCursor;
	import mx.controls.Alert;
	
	[Bindable] public class Gallery
	{
		public var name:String;
		public var description:String;
		public var photos:ArrayCollection;
		public var selected:int;
		public var is_enabled:Boolean;

		private var photo:Photo;
		
		public function Gallery(gallery:Object=null)
		{
			photos = new ArrayCollection();
			if (gallery != null)
			{
				set_properties(gallery);
			}
		}
		
		public function set_properties(gallery:Object):void
		{
			this.name = gallery.id;
			this.description = gallery.description;
			this.selected = 0;
			this.is_enabled = true;
			
			for (var i:int=0; i < gallery.photo.length(); i++)
			{
				photo = new Photo(gallery.photo[i]);
				photos.addItem(photo);
			}
		}
	}
}